<template>
    <div class="box">
        <div class="inp">
            <div class="login">
                <h1>登录</h1>
            <span class="span">用户名：</span><el-input placeholder="请输入用户名" v-model="user" clearable class="input"></el-input><br>
            <span id="span" class="span">密码：</span><el-input placeholder="请输入密码" v-model="password" show-password  class="input"></el-input><br>
            <span id="register">没有账号？点击<a @click="Jump">注册</a></span>
            <div class="submit"><button id="button" @click="login">登录</button></div>
        </div>
        </div>
    </div>
</template>

<script>
    export default {
        data() {
            return {
                user: '',
                password: ''
            }
        },
        methods:{
            login(){
                console.log(this.user,this.password);
                this.$store.dispatch('login_info',{//触发actions的方法 并且传递参数
                    user_name:this.user,
                    password:this.password,
                    routerT:this.$router
                })
            },
            Jump(){
                this.$router.replace('/register')
            }
        }
    }
</script>

<style scoped>
.box{
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background-image: linear-gradient(to left, #fd79a8, #a29bfe);
}
.inp{
    width: 350px;
    height: 400px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: white;
    border-radius: 15px;
}
.login{
    width: 350px;
    height: 300px;
}
.input{
    width: 70%;
    margin-bottom: 30px;
}
.span{
    color: black;
    font-size: 17px;
    margin-left: 10px;
}
#span{
    display: inline-block;
    margin-right: 18px;
}
h1{
    font: 900 40px '';
    text-align: center;
    margin-bottom: 60px;
}
.submit{
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}
#button{
    border: 0;
    width: 200px;
    height: 40px;
    background-image: linear-gradient(to left, #fd79a8, #a29bfe);
    border-radius: 15px;
    font-weight: bold;
    cursor: pointer;
    color: white;
}
#register{
    display: block;
    font-size:12px;
    margin-bottom:20px;
    margin-left: 10px;
}
a{
    color: #a29bfe;
    cursor:pointer;
}
a:hover{
    color: #fd79a8;
    cursor:pointer;
}
</style>